{% extends "base.html" %}
{% load bootstrap3 %}
{% block title %}{% if title %}{{ title }}{% else %}小时数据{% endif %}{% endblock %}

{% block head_script_block %}
<script src="/js/show_rawdata_realtime.js"></script>

{% endblock %}
{% block body_content_block %}
<div class="row-fluid">
    <div class="span4">
        <legend>门店筛选</legend>
        <form  action="./" method="post">{% csrf_token %}
            {% bootstrap_form form layout='horizontal' %}

            <input class='btn btn-primary' id='button' type='submit' value='查询'/>
        </form>
    </div>
    <div class="span8">

        {% if rssi_datas %}

        {% for mac,macdatas in rssi_datas.iteritems %}

            {% if macdatas.avg_rssi %}
            <legend>{{ mac }}期望Rssi ： {{ macdatas.avg_rssi }}</legend>
            {% endif %}
            <table class="table table-bordered" id="rssi_datas">
                <thead>
                <tr>

                    <th>db值</th>
                    <th>出现次数</th>
                </tr>
                </thead>

                <tbody id="rssi_datas_body">
                {% for rssi,count in macdatas.data.iteritems %}
                <tr>
                    <td>{{ rssi }}</td>
                    <td>{{ count }}</td>
                </tr>
                {% endfor %}
                </tbody>
            </table>

        {% endfor %}
        {% endif  %}
    </div>
</div>

<script>


    $(document).ready(function() {
        /*
         //var rssiDatas="{{ rssi_datas }}"
         var rssiDatas="[[&quot;-74&quot;, &quot;139&quot;], [&quot;-88&quot;, &quot;8&quot;], [&quot;-86&quot;, &quot;7&quot;], [&quot;-84&quot;, &quot;5&quot;], [&quot;-82&quot;, &quot;4&quot;], [&quot;-80&quot;, &quot;12&quot;], [&quot;-32&quot;, &quot;123&quot;], [&quot;-60&quot;, &quot;302&quot;], [&quot;-62&quot;, &quot;358&quot;], [&quot;-64&quot;, &quot;393&quot;], [&quot;-66&quot;, &quot;403&quot;], [&quot;-68&quot;, &quot;371&quot;], [&quot;-40&quot;, &quot;42&quot;], [&quot;-46&quot;, &quot;177&quot;], [&quot;-44&quot;, &quot;116&quot;], [&quot;-34&quot;, &quot;121&quot;], [&quot;-72&quot;, &quot;188&quot;], [&quot;-90&quot;, &quot;1&quot;], [&quot;-38&quot;, &quot;26&quot;], [&quot;-48&quot;, &quot;245&quot;], [&quot;-56&quot;, &quot;302&quot;], [&quot;-28&quot;, &quot;14&quot;], [&quot;-76&quot;, &quot;51&quot;], [&quot;-54&quot;, &quot;242&quot;], [&quot;-70&quot;, &quot;266&quot;], [&quot;-50&quot;, &quot;170&quot;], [&quot;-52&quot;, &quot;188&quot;], [&quot;-36&quot;, &quot;60&quot;], [&quot;-78&quot;, &quot;26&quot;], [&quot;-58&quot;, &quot;304&quot;], [&quot;-30&quot;, &quot;94&quot;], [&quot;-42&quot;, &quot;88&quot;]]"
         rssiDatas = eval("(" + rssiDatas.replace(/&quot;/g,"'") + ")");
         */
        $('#rssi_datas').dataTable( {

            /* "data": rssiDatas,*/
            "language":{
                'url':'/js/dataTables.language.chinese.json'
            },
            "sDom": 'T<"clear">lfrtip',
            "tableTools": {
                "aButtons": [
                    {
                        "sExtends": "csv",
                        "oSelectorOpts": {
                            page: 'all'
                        },
                        "sButtonText": "导出CSV"

                    },
                    {
                        "sExtends": "xls",
                        "oSelectorOpts": {
                            page: 'all'
                        },
                        "sButtonText": "导出EXCEL"
                    }
                ]

            },
            "aLengthMenu":[[100],[100]]

        } );
    } );


    $('#id_startTime').datetimepicker({format: 'yyyy-mm-dd',
        language:  'zh-CN',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        minView: 2,
        forceParse: 0});
    $( ".target" ).change(function() {
        $("#button").click()
    });
    $('#id_endTime').datetimepicker({format: 'yyyy-mm-dd',
        language:  'zh-CN',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        minView: 2,
        forceParse: 0});


</script>

{% endblock %}
